package com.amaake.server;

import com.jfinal.plugin.IPlugin;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Amaake
 * \* Date: 2016/11/15 0015
 * \* Time: 20:42
 * \* Description: 春眠不觉晓，起来敲代码。
 * \
 */
public class AmaakeServerRpcPlugin implements IPlugin {

    private int port=8080;
    private boolean activeAuth = false;
    private String privatekey = "";
    private RpcServiceLists rpcServiceLists = null;
    private AmaakeServerRpc amaakeServerRpc = null;


    public void setPort(int port) {
        this.port = port;
    }

    public void setActiveAuth(boolean activeAuth) {
        this.activeAuth = activeAuth;
    }

    public void setPrivatekey(String privatekey) {
        this.privatekey = privatekey;
    }

    public void setRpcServiceLists(RpcServiceLists rpcServiceLists) {
        this.rpcServiceLists = rpcServiceLists;
    }

    public boolean start() {
        rpcServiceLists.init();
        amaakeServerRpc = new AmaakeServerRpc(port, activeAuth,  privatekey , rpcServiceLists);
        amaakeServerRpc.start();
        return true;
    }

    public boolean stop() {
        amaakeServerRpc.stop();
        return true;
    }
}